﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Utility;
using Utility.Model;
using Hxj.Data;
using Utility.Json;

namespace MsgCenter.Web.Handlers
{
    /// <summary>
    /// Handler_Operate 的摘要说明
    /// </summary>
    public class Handler_Operate : BaseUI.BaseHandler
    {
        /// <summary>
        /// 获取功能列表,提供模块选择功能
        /// </summary>
        public void GetSelectOperateList()
        {
            string strModuleID = ParamsOfRequest.Request("ModuleID");
            WhereClip wcp = new WhereClip();
            wcp = wcp.And(Sys_Operate._.IsDelete == false);
            wcp = wcp.And("OperateID not in (select OperateID from Sys_ModuleOperate where ModuleID='" + strModuleID + "')");
            var pageConditon = base.GetPageConditon(wcp);
            pageConditon.PageSize = 10000;
            JsonJqGridData gridList = BLL.BLLServiceHelper.GetBaseDataService().GetGridDataTable<Sys_Operate>(pageConditon);
            string strResult = gridList.ToJsonString();
            base.Response.Write(strResult);
        }
        /// <summary>
        /// 获取功能列表分页
        /// </summary>
        public void GetOperateList()
        {
            WhereClip wcp = new WhereClip();
            wcp = wcp.And(Sys_Operate._.IsDelete == false);
            var pageConditon = base.GetPageConditon(wcp);
            JsonJqGridData<Sys_Operate> gridList = BLL.BLLServiceHelper.GetBaseDataService().GetGridDataList<Sys_Operate>(pageConditon);
            string strResult = gridList.ToString();
            Response.Write(strResult);
        }
        /// <summary>
        /// 删除
        /// </summary>
        public void Delete()
        {
            try
            {
                string strID = ParamsOfRequest.Request("ActivityID");
               BLL.BLLServiceHelper.GetOperateService().Delete(strID);
                base.GetSuccessJson();
            }
            catch (Exception ex)
            {
                base.GetFailureJson(ex.Message);
            }
        }
    }
}